package com.shanzmoo.platform.manage.api.web.member;

import com.shanzmoo.base.bean.PageRespBase;
import com.shanzmoo.base.bean.SHttpResponse;
import com.shanzmoo.db.module.member.domain.dto.CardConfigSaveDTO;
import com.shanzmoo.db.module.member.domain.dto.MemberCardConfigDTO;
import com.shanzmoo.db.module.member.domain.query.*;
import com.shanzmoo.db.module.member.domain.vo.MemberAccountRecordVO;
import com.shanzmoo.db.module.member.domain.vo.MemberInfoDetailVO;
import com.shanzmoo.db.module.member.domain.vo.MemberInfoVO;
import com.shanzmoo.db.module.member.domain.vo.*;
import com.shanzmoo.platform.manage.api.manager.PlfMemberManage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "平台管理系统-会员管理")
@RestController
@RequestMapping("/plf/member")
public class MemberController {
    @Autowired
    private PlfMemberManage plfMemberManage;

    @ApiOperation(value = "会员中心-交易列表")
    @PostMapping("/list")
    public SHttpResponse<PageRespBase<MemberInfoVO>> memberList(@RequestBody MemberQuery query) {

        return plfMemberManage.getMemberListPage(query);
    }

    @ApiOperation(value = "会员中心-平台会员详情")
    @GetMapping("/detail")
    public SHttpResponse<MemberInfoDetailVO> memberDetail(@RequestParam(value = "id",required = true) Integer id) {

        return plfMemberManage.memberDetail(id);
    }

    @ApiOperation(value = "会员中心-会员卡交易记录")
    @PostMapping("/account/list")
    public SHttpResponse<PageRespBase<MemberAccountRecordVO>> accountList(@RequestBody MemberMerchantIdPageQuery query) {

        return plfMemberManage.accountList(query);
    }

    @ApiOperation(value = "会员中心-积分变动记录")
    @PostMapping("/score/list")
    public SHttpResponse<PageRespBase<MemberAccountScoreRecordVO>> memberScoreList(@RequestBody MemberMerchantIdPageQuery request) {
        return plfMemberManage.getMemberMerchantScoreList(request);
    }
    @ApiOperation(value = "会员中心-会员开通记录")
    @PostMapping("/open/list")
    public SHttpResponse<PageRespBase<MemberOpenVO>> memberDredgeList(@RequestBody MemberMerchantIdPageQuery request) {
        return plfMemberManage.getMemberOpenList(request);
    }

    @ApiOperation(value = "储值消费-交易列表")
    @PostMapping("/account/trans/list")
    public SHttpResponse<PageRespBase<MemberAccountTransVO>> transList(@RequestBody MemberTransPageQuery request) {

        return plfMemberManage.transList(request);
    }

    @ApiOperation(value = "储值消费-充值详情")
    @GetMapping("/account/recharge/detail")
    public SHttpResponse<MemberAccountRechargeDetailVO> rechargeDetail(@RequestParam(value = "id",required = true) Integer id) {

        return plfMemberManage.rechargeDetail(id);
    }
    @ApiOperation(value = "储值消费-消费详情")
    @GetMapping("/account/consume/detail")
    public SHttpResponse<MemberAccountConsumeDetailVO> accountConsumeDetail(@RequestParam(value = "id",required = true) Integer id) {

        return plfMemberManage.consumeDetail(id);
    }

    @ApiOperation(value = "会员卡管理-列表")
    @PostMapping("/card/config/list")
    public SHttpResponse<PageRespBase<PlfMemberCardConfigVO>> cardList(@RequestBody PlfMemberCardConfigQuery query) {

        return plfMemberManage.getCardList(query);
    }
    @ApiOperation(value = "会员卡管理-交易列表-保存")
    @PostMapping("/card/config/save")
    public SHttpResponse<Boolean> cardConfigSave(@RequestBody CardConfigSaveDTO request) {

        return plfMemberManage.saveCardConfig(request);
    }
    @ApiOperation(value = "会员卡管理-交易列表-详情")
    @GetMapping("/card/config/listDetail")
    public SHttpResponse<CardConfigDetailVO> cardConfigDetail() {

        return plfMemberManage.getCardConfigDetail();
    }
    @ApiOperation(value = "会员卡管理-详情")
    @GetMapping("/card/config/detail")
    public SHttpResponse<MemberCardConfigDTO> cardConfigDetail(@RequestParam(value = "id",required = true) Integer id) {
        return plfMemberManage.cardConfigDetail(id);
    }

    @ApiOperation(value = "活动管理-活动列表")
    @PostMapping("/activity/list")
    public SHttpResponse<PageRespBase<MemberActivityConfigVO>> activityList(@RequestBody MemberActivityPageQuery request) {
        return plfMemberManage.activityList(request);
    }
    @ApiOperation(value = "活动管理-活动详情")
    @GetMapping("/activity/detail")
    public SHttpResponse<MemberActivityConfigVO> activityList(@RequestParam(value = "id",required = true) Integer id) {
        return plfMemberManage.activityDetail(id);
    }
    @ApiOperation(value = "优惠券管理-优惠券")
    @PostMapping("/coupon/list")
    public SHttpResponse<PageRespBase<MemberCouponConfigVO>> couponList(@RequestBody MemberCouponConfigPageQuery request) {
        return plfMemberManage.getCouponList(request);
    }
    @ApiOperation(value = "优惠券管理-优惠券详情")
    @GetMapping("/coupon/detail")
    public SHttpResponse<MemberCouponConfigVO> couponDetail(@RequestParam Integer id) {
        return plfMemberManage.getCouponDetail(id);
    }
    /**
     *
     *
     * @return
     */
    @ApiOperation(value = "会员卡管理-发送短信信息")
    @GetMapping("/sendSmsMsg")
    public SHttpResponse<Boolean> sendSmsMsg() {
        return plfMemberManage.sendSmsMsg();
    }
}
